# coding: utf-8
'''
Created on May 23rd, 2011

@author: manux
'''
import unittest
from dao.DaoDamier import DaoDamier 

class Test(unittest.TestCase):

    def setUp(self):
        self.daoDamier = DaoDamier("niveau2")

    def tearDown(self):
        del self.daoDamier
    
    def test_chemin(self):
        self.assertEqual(self.daoDamier._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])

    def test_height(self):
        self.assertEqual(self.daoDamier.height, 6)

    def test_width(self):
        self.assertEqual(self.daoDamier.width, 12)
    
    def test_len_terrainType(self):
        self.assertEqual((self.daoDamier.height * self.daoDamier.width),\
                         len(self.daoDamier.terrainType))
    
    def test_cases_arbre(self):
        for x in ('C3',\
                  'H2',):
            self.assertEqual(self.daoDamier.terrainType[x][:-1], 'Arbre')
    
    def test_cases_glace(self):
        for x in ('E3',\
                  'F3', 'F4',\
                  'G3', 'G4',\
                  'H4'):
            self.assertEqual(self.daoDamier.terrainType[x][:-1], 'Glace')
    
    def test_cases_neige(self):
        for x in ('A1', 'A2', 'A3', 'A4', 'A5', 'A6',\
                  'B1', 'B3', 'B4', 'B5', 'B6',\
                  'C1', 'C4', 'C5', 'C6',\
                  'D1', 'D2', 'D3', 'D4', 'D5', 'D6',\
                  'E1', 'E2', 'E4', 'E5', 'E6',\
                  'F1', 'F2', 'F5', 'F6',\
                  'G1', 'G2', 'G5', 'G6',\
                  'H1', 'H3', 'H5', 'H6',\
                  'I1', 'I3', 'I4', 'I5', 'I6',\
                  'J1', 'J2', 'J3', 'J4', 'J6',\
                  'K1', 'K2', 'K3', 'K4', 'K5', 'K5',\
                  'L1', 'L2', 'L3', 'L4', 'L5', 'L6'):
            self.assertEqual(self.daoDamier.terrainType[x][:-1], 'Neige')
    
    def test_cases_rocher(self):
        for x in ('B2',\
                  'C2',\
                  'I2',\
                  'J5'):
            self.assertEqual(self.daoDamier.terrainType[x][:-1], 'Rocher')


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()
